#pragma once

namespace GSTrader
{
	namespace Config
	{
	
		class USER_CONFIG_API CSettingData
		{
		public:
			CSettingData();
			virtual ~CSettingData();

			CSettingData(bool bData);
			CSettingData(double nData);
			CSettingData(string strData);
			CSettingData(void* pData);

			double GetNumberData();
			string GetStringdata();
			void* GetData();
			bool GetBoolData();

			void SetNumberData(double dValue);
			void SetStringData(string strValue);
			void SetData(void* pData);
			void SetBoolData(bool bData);
		private:
			bool m_bData;
			double m_dData;
			string m_strData;
			void* m_pData;
		};

		class USER_CONFIG_API CSettingItem
		{
		public:
			CSettingItem(string strKey, bool bVaule);
			CSettingItem(string strKey, double dValue);
			CSettingItem(string strKey, string strValue);
			CSettingItem(string strKey, void* pData);
			virtual ~CSettingItem();

		public:
			string m_strKey;
			int m_nDataType;
			CSettingData* m_pSettingData;
		};

	
		class USER_CONFIG_API CGlobalSetting
		{
		public:
			CGlobalSetting();
			virtual ~CGlobalSetting();

			void LoadDefaultSetting();

			void AddSetting(const CSettingItem* pSetting);
			void SetNumberSetting(string strKey, double dData);
			void SetStringSetting(string strKey, string strData);
			void SetSettingData(string strKey, void* pData);
			void SetBoolSetting(string strKey, bool bData);

			bool GetNumberSetting(string strKey, double& dNumber);
			bool GetStringSetting(string strKey, string& strData);
			void* GetSettingData(string strKey);
			bool GetBoolSetting(string strKey, bool& bData);
			
			void RemoveAll();
			
			bool ReadIniFile(string filePath, string strKey);
			void GetSetting(string strKey, bool bLike, vector<CSettingItem*>& vItem);
		private:

#ifdef _RUN_WINDOWS_
			void EnumIniFile(string pFilePath, string strKey);
#endif 
			map<string, CSettingItem*> m_mapSetting;
		};
	}
}

